<template>
    <h1>Page 4</h1>
    <p>id:{{ id }}</p>
    <p>type:{{ type }}</p>
    <button @click="handleClick">主页</button>
</template>

<script lang="ts" setup>
import { ref, onMounted } from "vue";
import { useRouter, useRoute } from 'vue-router';

const router = useRouter()
const route = useRoute()
const id = <any>ref(''), type = <any>ref('')
// const handleClick = () => router.push({ path: '/Home' })
const handleClick = () => router.go(-1)

onMounted(() => {
    console.log('页面重新加载', route.params.id, route.params.type);
    id.value = route.params.id;
    type.value = route.params.type;
})
</script>